<template>
    <div>
        <h3>管理员登录</h3>
        <table>
            <tr>
                <td>账号</td>
                <td>
                    <input type="text" v-model="state.Aname">
                </td>
            </tr>
            <tr>
                <td>密码</td>
                <td><input type="password" v-model="state.Apwd"></td>
            </tr>
            <tr>
                <td>
                    <input type="button" value="登录" @click="denglu">
                </td>
                <td></td>
            </tr>
        </table>
    </div>
</template>

<script setup lang="ts">
import { reactive, toRefs } from 'vue';
import { useRouter } from 'vue-router';
import axios from 'axios';
const router = useRouter()
const data = reactive({
    state: {
        Aname: '',
        Apwd: ''
    }
})
const { state } = toRefs(data)
const denglu = () => {
    axios({
        url: 'https://localhost:7144/api/Login/adminLogin',
        method: 'get',
        params: state.value
    }).then(res => {
        if (res.data.code != "") {

            alert("登录成功")
            router.push('/admin')

        } else {
            alert("登录失败")

        }
    })

}



</script>

<style scoped></style>